package com.cow.support.sys.scheduleWork;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpServlet;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.cow.support.sys.bean.BeanFactory;
import com.cow.support.util.ConfigurationUtil;
/**
 * �����ļ�����
 * 
 * @author yangsj
 **/  
public class ContextListener extends HttpServlet implements ServletContextListener {
	private static final long serialVersionUID = -4580097227825752450L;
	public ContextListener() {
	}

	private java.util.Timer timer = null;
	public void contextInitialized(ServletContextEvent event) {	
		ServletContext context = event.getServletContext();
		//��ȡspring������
		ApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(context);
		//ΪBeanFactory����������
		BeanFactory.loadContext(applicationContext);
	}

	public void contextDestroyed(ServletContextEvent event) {
//		timer.cancel();
//		event.getServletContext().log("��ʱ������");
	}

}